package com.yaowk.authc.validator;

import com.jfinal.core.Controller;
import com.jfinal.kit.PropKit;
import com.jfinal.validate.Validator;
import com.yaowk.common.kit.I18nKit;
import com.yaowk.common.kit.ResultKit;
import com.yaowk.common.validator.BaseValidator;


/**
 * Created by yaowk on 2017/4/3.
 */
public class LoginValidator extends BaseValidator {
    @Override
    protected void validate(Controller c) {

        // get请求不用验证
        if (c.getRequest().getMethod().equals("GET")) {
            return;
        }

        validateRequiredString("password", "errorMsg", I18nKit.get("password_empty", "authc", c));
        validateRequiredString("username", "errorMsg", I18nKit.get("username_empty", "authc", c));
    }
}
